{{- $version := "0.21.0" }}
---
artifact: {{ .ModuleName }}/build-artifact
from: {{ .Images.BASE_GOLANG_20_ALPINE }}
mount:
  - fromPath: ~/go-pkg-cache
    to: /go/pkg
shell:
  beforeInstall:
    - apk add --no-cache git
  install:
    - mkdir /src
    - cd /src
    - git clone --depth 1 --branch v{{ $version }} {{ $.SOURCE_REPO }}/kubernetes-sigs/descheduler.git .
    - GOPROXY={{ $.GOPROXY }} CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.version={{ $version }} -X main.gitCommit=b59995eeb8b3733c635059c041aa30c8c04f5e33" -o descheduler sigs.k8s.io/descheduler/cmd/descheduler
    - chown 64535:64535 descheduler
    - chmod 0700 descheduler
---
image: {{ .ModuleName }}/{{ .ImageName }}
fromImage: common/distroless
import:
  - artifact: {{ .ModuleName }}/build-artifact
    add: /src/descheduler
    to: /descheduler
    before: setup
docker:
  ENTRYPOINT: ["/descheduler"]
